Sales Credit POST
URI
https://{DATACENTER}.brightpearlconnect.com/public-api/{ACCOUNT}
/accounting-service/invoice/sales-credit/
Refer to our documentation on URI syntax for more information on how to construct URIs.
Description
Transforms the sent Credit resource into the corresponding journal lines. This endpoint uses specific logic to validate the credit representation, but then delegates to the journal entry logic to validate and create the lines in the database.
Sales Credit POST Validation
Mandatory elements are the header, the invoice identifier inside the header, and at least one line
The fields that are mandatory are:
- contactId
- taxDate
- currencyId
- exchangeRate (not mandatory for base currency)
- Each line must have a net amount and a tax amount (values of the transaction in the currency stated), a tax code and a nominal code
Other validations are:
- The order id must be in the system
- The order must be of type sales order and belong to the customer
- The contact must be of type customer
- Nominal code can neither be Debtors Control Account ("1100", accounts receivable) nor Creditors Control Account ("2100", accounts payable)
The journal-entry POST is then validating additional accounting rules, if applicable.
Example
Creating a sales credit for customer 200 at net value of 10 plus tax in the currency 2 at exchange rate 1.423567. Returns the journal id if successful.
Request URI
/invoice/sales-credit/
Request body
{
"header": {
"contactId": 200,
"taxDate": "2015-07-14",
"dueDate": "2015-08-14",
"description": "Sales credit",
"currencyId": 1,
"exchangeRate": 1.000000,
"orderId": 2
},
"lines": [
{
"net": 10.00,
"tax": 2.00,
"nominalCode": "4000",
"taxClassId": 3,
"projectId": 1,
"leadSourceId": 1,
"channelId": 1
},
{
"net": 5.00,
"tax": 0.00,
"nominalCode": "4001",
"taxClassId": 1,
"projectId": 1,
"leadSourceId": 1,
"channelId": 1
}
]
}
Response
{
"response": 20
}